package cz.muni.fi.pb162.project.geometry;
import java.util.Comparator;

/**
 * Write a description of class VertexInverseComparator here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class VertexInverseComparator implements Comparator<Vertex2D>
{

    /**
     * Compares vertexes descendingly according to their X coordinates, or Y icoordinates f Xs are equivalent
     * @param
     * @param
     * @return
     */
    public int compare(Vertex2D vert1, Vertex2D vert2) {
        if(Math.abs(vert1.getX() - vert2.getX()) < Vertex2D.EPSILON) {
            if(Math.abs(vert1.getY() - vert2.getY()) < Vertex2D.EPSILON) {
                return 0;
            }
            if((vert1.getY() - vert2.getY()) < 0) {
                return 1;
            }
            return -1;
        }
        if((vert1.getX() - vert2.getX()) < 0) {
            return 1;
        }
        return -1;
    }
}
